home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4727 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: unix.sri.com!usenet
  2. From: mklenk@coronacorp.com (Mark Klenk)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: open vs fopen?
  5. Date: 6 Feb 1996 16:22:54 GMT
  6. Organization: Nuance Communications
  7. Message-ID: <4f7v8u$3s2@unix.sri.com>
  8. References: <uEYFxc9nX8WX083yn@mbnet.mb.ca>
  9. Reply-To: mklenk@coronacorp.com
  10. NNTP-Posting-Host: 204.75.161.40
  11.  
  12. Nathan Wild asked:
  13. >
  14. >In C, why would one use open and DOS int handles rather than fopen and
  15. >stdio file handles?
  16.  
  17.     open() and family are really UNIX-isms that DOS adopted.
  18.  
  19.     To answer your question, though:
  20.  
  21.      a)  file I/O through open/close/read/write/lseek is generally
  22.           unbuffered and therefore in some cases faster, especially
  23.           in random-access situations
  24.  
  25.      b)  ANSI C only defines fopen/fclose/fread/fwrite/fseek, which
  26.           by default usually provide buffered, but more portable, I/O
  27.  
  28.      c)  for sequential access, the f*() functions can improve I/O
  29.           performance because they generally do read-ahead and
  30.           write-behind in order to match system block-sizes more
  31.           closely
  32.  
  33. ---
  34.  
  35. mklenk@coronacorp.com       (Mark Klenk)
  36.  
  37.  
  38.  
  39.